﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TA.Win.Utils.Design;
using System.Web.UI;
using TA.Turbo.Controls;
namespace TA.Turbo.Design
{
	public class ValidationGroupOptionsProvider : IStringOptionsProvider
	{
		#region IStringOptionsProvider Members

		public StringOptions GetOptions(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider)
		{
			StringOptions res = new StringOptions
			{
				DuplicatesAllowed = false,
				CustomValueAllowed = true,
				ValueComparison = StringComparison.CurrentCulture,
			};
			Control control = context.Instance as Control;
			if (control != null)
			{
				res.Options = this.GetLister().GetValidationGroupList(control);
			}
			return res;
		}

		#endregion
		protected virtual BaseValidationGroupLister GetLister()
		{
			return new ValidationGroupLister();
		}
	}
}
